package Collection.work;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class Itertorwork {
    public static void main(String[] args) {

        Collection<String> c=new ArrayList<>();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        System.out.println("c:"+c);

        Iterator<String> it=c.iterator();
        while (it.hasNext()){

            String str= it.next();
            System.out.println(str);

        }
        for (String str:c){
            System.out.println(str);
        }
    }
}
